package a2023.a0901;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lenovo
 * @date 2023/9/1
 */
public class a {
    public static void main(String[] args) {
        System.out.println(waysToBuyPensPencils(20, 10, 5));
    }

    public static long waysToBuyPensPencils(int total, int cost1, int cost2) {
        if (total < cost1 && total < cost2) {
            return 1;
        }
        Long l = 0L;
        int i = total / cost1;
        for (int j = 0; j <= i; j++) {
            l += (total - (j * cost1)) / cost2 + 1;
        }
        return l;
    }
//    public static long waysToBuyPensPencils(int total, int cost1, int cost2) {
//        long ans = 0;
//        if (total < cost1 && total < cost2) {
//            return 1;
//        }
//        for (int i = 0; i * cost1 <= total; i++) {
//            int leave = total - i * cost1;
//            ans += leave/cost2 + 1;
//        }
//        return ans;
//    }
}
